package cn.itcast.demo.task;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;

/**
 * @author 虎哥
 */
@Slf4j
//@Component
public class HelloTask {


    boolean b = true;
    @Scheduled(cron = "0/1 * * * * ?")
//    @Scheduled(fixedDelay = 2000)
//    @Scheduled(fixedRate = 1000)
    public void helloJob() throws InterruptedException {
        log.error("正在执行。。。");
        if (b) {
            Thread.sleep(3000);
            b = false;
        }

    }
}
